package com.example.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.demo.controller.dto.UserAddressDto;
import com.example.demo.entity.Orderlist;
import com.example.demo.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface OrderlistMapper extends BaseMapper<Orderlist> {

    @Update("update orderlist set state = #{state},pay_time = #{payTime} where order_no = #{orderNo}")
    int updateState(@Param("orderNo") String orderNo, @Param("state") int state, @Param("payTime") String payTime);



    @Select("select count(id) count, name from user GROUP BY name")
    List<UserAddressDto> countAddress();
}
